package com.originskyseed.platform.user.service;

import java.util.List;
import java.util.Map;

import com.originskyseed.platform.core.base.BasePage;
import com.originskyseed.platform.role.model.RoleRelUser;
import com.originskyseed.platform.user.model.TaskSelectSaleManVO;
import com.originskyseed.platform.user.model.UserInfo;

/**
 * 用户信息表Service接口类（OSI_USER_INFO）
 *
 * @author LiangMingHui
 */
public interface IUserInfoService {

	/**
	 * 删除记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	/* public int deleteByPrimaryKey(String id) throws Exception; */

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(UserInfo record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(UserInfo record) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(UserInfo record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(UserInfo record) throws Exception;


	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param id
	 * @param levelId
	 * @return
	 * @throws Exception
	 */
	public int updateLevelIdByUserId(String id,String levelId) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByPrimaryKeyTenantCode(String id, String tenantCode) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param account
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByAccount(String account) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param account
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectAllByAccount(String account) throws Exception;

	/**
	 * 根据用户名称查询
	 *
	 * @param username
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByName(String username) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<UserInfo> selectList(UserInfo record) throws Exception;

	/**
	 * 查询导出列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<UserInfo> selectExportExcelList(UserInfo record) throws Exception;

	/**
	 * 培训任务查询新员工
	 *
	 * @return
	 */
	public List<UserInfo> taskSelectNewUserList(Map<String, Object> map, String tenantCode) throws Exception;

	/**
	 * 培训任务查询新员工
	 *
	 * @return
	 */
	public List<UserInfo> taskSelectNewUserByTimeList(Map<String, Object> map) throws Exception;

	/**
	 * 根据部门ID查询用户
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectUserIdsByDeptIds(List<String> deptIdList) throws Exception;

	/**
	 * 根据部门ID查询用户
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectAccountByDeptIds(List<String> deptIdList) throws Exception;

	/**
	 * 根据部门ID查询主播id
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectAnchorIdsUserIdsByDeptIds(List<String> deptIdList) throws Exception;

	/**
	 * 根据部门ID查询业务员用户id
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectSalesmanUserIdsByDeptIds(List<String> deptIdList) throws Exception;

	/**
	 * 根据部门ID查询主播用户id
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectAnchorIdsByDeptIds(List<String> deptIdList) throws Exception;

	/**
	 * 根据部门ID查询用户表中主播的第三方主键
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectAnchorOtherAccountsByDeptIds(List<String> deptIdList) throws Exception;

	/**
	 * 根据部门ID查询用户表中主播的第三方主键
	 *
	 * @param deptIdList
	 * @return
	 * @throws Exception
	 */
	public List<String> selectAnchorOtherAccountsByDeptIdsTenantCode(List<String> deptIdList,String tenantCode) throws Exception;

	/**
	 * 分页查询列表
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<UserInfo> selectListByPage(Map<String, Object> params, BasePage<UserInfo> page) throws Exception;

	/**
	 * 分页查询列表
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<UserInfo> selectListRelRoleByPage(Map<String, Object> params, BasePage<UserInfo> page) throws Exception;

	/**
	 * 选择维护人员信息
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<UserInfo> selectMaintainListByPage(Map<String, Object> params, BasePage<UserInfo> page) throws Exception;

	/**
	 * 选择业务员信息，全平台、公会下
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<TaskSelectSaleManVO> selectSaleInfoListByPage(Map<String, Object> params, BasePage<TaskSelectSaleManVO> page) throws Exception;

	/**
	 * 选择主播信息公会、全平台
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<TaskSelectSaleManVO> selectMaintainAnchorListByPage(Map<String, Object> params, BasePage<TaskSelectSaleManVO> page) throws Exception;


	/**
	 * 推广任务选择主播
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<TaskSelectSaleManVO> selectPromotionTaskAnchorListByPage(Map<String, Object> params, BasePage<TaskSelectSaleManVO> page) throws Exception;

	/**
	 * 根据公会Id分页查询列表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<UserInfo> selectListBytradeunionIdPage(Map<String, Object> params, BasePage<UserInfo> page) throws Exception;

	/**
	 * 根据openId获取用户信息
	 *
	 * @param openId
	 * @return
	 * @throws Exception
	 */
	public List<UserInfo> selectUserInfoByOpenId(String openId) throws Exception;

	/**
	 * 逻辑删除用户
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteLogicallyByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 逻辑更新（恢复）用户
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int updateLogicallyByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 启用或禁用用户
	 *
	 * @param ids
	 * @param status
	 * @return
	 * @throws Exception
	 */
	public int updateStatus(List<String> ids, Integer status) throws Exception;


	/**
	 * 签约或未签约
	 *
	 * @param ids
	 * @param isEconomicContract
	 * @return
	 * @throws Exception
	 */
	public int updateIsEconomic(List<String> ids, Integer isEconomicContract) throws Exception;

	/**
	 * 账号是否存在
	 *
	 * @param account
	 * @return
	 * @throws Exception
	 */
	public boolean existAccount(String account) throws Exception;

	/**
	 * 修改账号密码
	 *
	 * @param account
	 * @return
	 * @throws Exception
	 */
	public int updateUserInfoPassword(String account, String password) throws Exception;

	/**
	 * 查询账号是否存在
	 *
	 * @param account
	 * @return
	 * @throws Exception
	 */
	public UserInfo existUserInfoAccount(String account) throws Exception;

	/**
	 * 根据手机号获取用户信息
	 *
	 * @param mobileNumber
	 * @return
	 * @throws Exception
	 */
	public List<UserInfo> selectMobileNumber(String mobileNumber) throws Exception;

	/**
	 * 判断账户是否重复
	 *
	 * @param userInfo
	 * @return
	 * @throws Exception
	 */
	public Boolean accountExist(UserInfo userInfo) throws Exception;

	/**
	 * 判断账户是否重复
	 *
	 * @param userInfo
	 * @return
	 * @throws Exception
	 */
	public Boolean nameExist(UserInfo userInfo) throws Exception;

	/**
	 * 根据账号修改状态
	 *
	 * @param userInfo
	 * @return
	 * @throws Exception
	 */
	public int updateByAccount(UserInfo userInfo) throws Exception;

	/**
	 * 根据手机号查询用户信息
	 *
	 * @param phone
	 * @return
	 * @throws Exception
	 */
	UserInfo selectByPhoneNum(String phone) throws Exception;

	/**
	 * 手机号是否存在
	 *
	 * @param mobileNumber
	 * @return
	 * @throws Exception
	 */
	public boolean existMobileNumber(String mobileNumber) throws Exception;

	/**
	 * 根据账号和密码获取用户信息
	 *
	 * @param account
	 * @param password
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByAccountAndPassword(String account, String password) throws Exception;

	/**
	 * 更新登录信息
	 *
	 * @param id
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public UserInfo updateLoginInfo(String id, String ip) throws Exception;

	/**
	 * 批量插入
	 *
	 * @param userInfoList
	 * @return
	 * @throws Exception
	 */
	public int insertBatchUser(List<UserInfo> userInfoList) throws Exception;

	/**
	 * 批量插入
	 *
	 * @param userInfoList
	 * @return
	 * @throws Exception
	 */
	public int insertBatchUser(List<UserInfo> userInfoList, List<RoleRelUser> roleRelUserList) throws Exception;


	/**
	 * 插入
	 *
	 * @param userInfo
	 * @return
	 * @throws Exception
	 */
	public int insertBatchUser(UserInfo userInfo, RoleRelUser roleRelUser) throws Exception;

	/**
	 * 查询员工编号
	 *
	 * @return
	 * @throws Exception
	 */
	public String selectUserNum() throws Exception;

	/**
	 * 查询最大的优先级
	 *
	 * @return
	 * @throws Exception
	 */
	public Integer selectPrority() throws Exception;

	/**
	 * 根据优先级查询员工
	 *
	 * @param prority
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectUserByPrority(Integer prority) throws Exception;

	/**
	 * 更新排序信息
	 *
	 * @param downUser
	 * @param upUser
	 * @return
	 * @throws Exception
	 */
	public int updatePrority(UserInfo downUser, UserInfo upUser) throws Exception;

	/**
	 * 根据部门id查询员工数量
	 *
	 * @param deptId
	 * @return
	 * @throws Exception
	 */
	public int selectUserNumByDeptId(String deptId) throws Exception;

	/**
	 * 根据部门id查询员工数量
	 *
	 * @param deptId
	 * @return
	 * @throws Exception
	 */
	public int selectUserNumByStatusDeptId(String deptId) throws Exception;

	/**
	 * 根据部门id集合查询员工数量,排除异常状态的
	 *
	 * @param deptIds
	 * @return
	 * @throws Exception
	 */
	public int selectUserNumByStatusDeptIds(List<String> deptIds) throws Exception;

	/**
	 * 根据部门查询成员
	 *
	 * @param deptId
	 * @return
	 * @throws Exception
	 */
	public List<UserInfo> selectUserByDeptId(String deptId) throws Exception;

	/**
	 * 查询第三方主键是否存在
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<String> selectRepeatOtherId(Map<String, Object> map) throws Exception;

	/**
	 * 根据用户id查询用户id第三方主键
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public String selectOtherAccountById(String id) throws Exception;

	/**
	 * 根据第三方主键查询用户
	 *
	 * @param otherAccount
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByOtherAccount(String otherAccount) throws Exception;

	/**
	 * 根据第三方主键查询用户
	 *
	 * @param otherAccount
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByOtherAccountTenantCode(String otherAccount, String tenantCode) throws Exception;

	/**
	 * 根据部门查询业务员id
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public List<String> selectSalesmanIdsByDeptIds(List<String> list) throws Exception;


	/**
	 * 根据部门查询第三方账号
	 *
	 * @param type  1 内容 2 推广
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public List<String> selectOtherAccountByDeptIds( List<String> list, Integer type) throws Exception;

	/**
	 * 根据部门查询业务员id
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public List<String> selectSalesmanIdsByDeptIdsTenantCode(List<String> list,String tenantCode) throws Exception;

	/**
	 * 根据部门查询青芒主播id
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public List<String> selectAnchorOtherIdsByDeptIds(List<String> list) throws Exception;

	/**
	 * 查询新增的主播数量
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Integer selectAnchorNumberByTime(Map<String, Object> map) throws Exception;

	/**
	 * 邀请码是否存在
	 *
	 * @param account
	 * @return
	 * @throws Exception
	 */
	public boolean existOwnInvitationCode(String account) throws Exception;

	/**
	 * 根据根据当前时间查询新用户(租户模式)
	 *
	 * @param nowTime
	 * @return
	 * @throws Exception
	 */
	public List<UserInfo> selectUserByNowTimeTenantCode(String nowTime, String tenantCode) throws Exception;

	/**
	 * 根据邀请码查询员工
	 *
	 * @param ownInvitationCode
	 * @return
	 * @throws Exception
	 */
	public UserInfo selectByOwnInvitationCode(String ownInvitationCode) throws Exception;

}
